#ifndef _IOT_H_
#define _IOT_H_

#include <stdbool.h>

typedef struct
{
 bool human_state;
 bool light_state;
 bool auto_state;
} e_iot_data;

/**
 * @brief Wait for and process incoming messages.
 *
 * This function blocks until a message is received, typically used in a separate thread or task.
 *
 * @return int Returns 0 on success, or an error code on failure.
 */
int wait_message();

/**
 * @brief Initialize MQTT client and connection settings.
 *
 * This function sets up the MQTT client and prepares it for connecting to the broker.
 */
void mqtt_init();

/**
 * @brief Check if the MQTT client is currently connected to the broker.
 *
 * @return unsigned int Returns non-zero if connected, 0 if not connected.
 */
unsigned int mqtt_is_connected();

/**
 * @brief Send IoT device data to the MQTT broker.
 *
 * This function publishes the given IoT data to a predefined MQTT topic.
 *
 * @param iot_data Pointer to the IoT data structure to send.
 */
void send_msg_to_mqtt(e_iot_data *iot_data);

#endif // _IOT_H_